import { defineStore } from 'pinia'

export const useBookcase = defineStore('bookcase', {
  state: () => ({
    isFlex: true,
    isEdit: false,
    isHistoryEdit: false,
    historyDelCon: false,
    caseDelCon: false,
    bookChecked: [],
    fullBookChecked: [],
  }),
  actions: {
    // 全选 取消
    toggleAll() {
      if (this.bookChecked.length == this.fullBookChecked.length) {
        this.bookChecked = [];
        this.historyDelCon = false;
      } else {
        this.bookChecked = JSON.parse(JSON.stringify(this.fullBookChecked));
        this.historyDelCon = true;
      }
    },
    changeShow(val) {
      this.isFlex = val;
    },
    changeEdit(val) {
      this.isEdit = val;
    },
    changeHistoryEdit(val) {
      this.isHistoryEdit = val;
    }
  },
  getters: {

  },
})